/**
 * Description:
 * Class Name:ReadCustomPerson
 * Date:2022/5/3 13:26
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第15章_输入输出._15_8_Java9改进的对象序列化._15_8_5_自定义序列化;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class ReadCustomPerson {
    public static void main(String[] args) {
        try (
                var ois = new ObjectInputStream(new FileInputStream("Chapter_15_8_5_CustomPerson.txt"))
                ){
            var customPerson = (CustomPerson)ois.readObject();
            System.out.println(customPerson.getName());
            System.out.println(customPerson.getAge());
        }
        catch (Exception exception){
            exception.printStackTrace();
        }
    }
}
